import json


# 读取My.json文件
def readMyJson(path):
    with open(path, "r") as file:
        return DicMyJson(file.read())
        

# 将json转字典
def DicMyJson(string):
    return json.loads(string)

# 将字典转成json
def jsonMyJson(dic):
	return json.dumps(dic)

# 初始化My.json
def NewMyJson(username, password, myJson_path):
	myDic = {"username":username, "password":password}
	try:
		file = open(myJson_path, "w")
		file.write(jsonMyJson(myDic))
		file.close()
		return True
	except:
		return False


	
